<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<?php 
	$USER = getAccountUserObject();
	$ESCORT = $this->escort_entity->init('user_id',$USER->getId());
	
	$current_dbprefix = $this->db->dbprefix;
	$this->db->set_dbprefix('default_');
	
	$page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 0 ;
	$records_per_page = 10; 
	$total = count($this->db->where('user_id',$USER->getId())->get(TBL_LOG_ACTIONS)->result());
			
	$pagination = create_pagination( 
								$uri = 'agent/async/loadActionsLog?', 
								$total_rows = $total , 
								$limit= $records_per_page,
								$uri_segment = 0,
								TRUE, TRUE 
							);
	$records = $this->db->where(array("user_id"=>$USER->getId())) 
			->order_by('datetime','desc')->limit($records_per_page, $page )->get(TBL_LOG_ACTIONS)->result();
			
	$this->db->set_dbprefix($current_dbprefix);	
?>
<div class="select-box">
	<table>
		<thead>
			<th width="75%"><?php echo language_translate('action_log_label_atcion');?></th>
			<th width="25%"><?php echo language_translate('action_log_label_datetime');?></th>
		</thead>
		
		<tbody>
			
			<?php foreach($records as $item): ?>
				<tr>
					<td>
						<?php echo language_translate($item->slug);?>
					</td>
					<td>
						<?php echo sysDateFormat($item->datetime,'d/m/Y H:m');?>
					</td>
				</tr>
			<?php endforeach;?>
		</tbody>
	</table>	
</div>
<div class="clear"></div>

<div class="pagging">
	<div id="browse_threads">
		<?php echo $pagination['links'];?>
	</div>
</div>	


